#include "LiveViewThread.h"

LiveViewThread::LiveViewThread(QObject *parent) : QThread(parent)
{
    stopped = true;

    gpioPort = GpioPort::getInstance();
}

void LiveViewThread::run()
{
    stopped = false;

    bool state;
    while(!stopped) {
        if(gpioPort->getState(7, &state))
            continue;

        if(state) {
            emit reloadImage();
            usleep(RELOAD_MSCSECS_TIMEOUT);
        }
    }
}

void LiveViewThread::stop()
{
    stopped = true;
}
